package com.boot6;

import com.boot6.mapper.DeptMapper01;
import com.boot6.mapper.EmpMapper;
import com.boot6.mapper.EmpMapper01;
import com.boot6.pojo.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

@SpringBootTest
class SpringBoot6Mybatis3ApplicationTests01 {
    @Autowired
    EmpMapper01 empMapper01;
    
    @Autowired
    DeptMapper01 deptMapper01;

  @Test
    void testXmlResultMapTest(){
      List<Emp01> list = empMapper01.getList();
      for (Emp01 emp01 : list) {
          System.out.println("emp01 = " + emp01);
      }

  }


    @Test
    void testXmlResultMapByIdTest(){
        /*EmpVo01 byIdEmp01 = empMapper01.getByIdEmp01(1);
        System.out.println("byIdEmp01 = " + byIdEmp01);*/
        /*EmpVo01 byIdEmp02 = empMapper01.getByIdEmp02(1);
        System.out.println("byIdEmp02 = " + byIdEmp02);*/
        EmpVo01 byIdEmp02 = empMapper01.getByIdEmp03(1);
        System.out.println("byIdEmp02 = " + byIdEmp02.getUsername());
        System.out.println("byIdEmp02 = " + byIdEmp02.getDept());

    }


    @Test
    void testGetDeptAndEmp(){
        DeptVo01 deptById = deptMapper01.getDeptById(2);
        System.out.println("deptById = " + deptById);

    }
    
    @Test
    void testGetDeptAndEmpStep(){
        DeptVo01 deptById01 = deptMapper01.getDeptById01(2);
        System.out.println("deptById01 = " + deptById01);
        
    }
}
